package com.groupbuying.sysconfig.dto.app;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Description 支付宝生活号模版消息
 * @Auther Davidbieber
 * @Email davidbieber@163.com
 * @Date 2019/10/17 4:58 PM
 */
public class AppAlipayInfo {

    private String toUserId;
    private String templateId;
    private String headColor;
    private String url;
    private String actionName;
    private List<AppDataInfo> data;

    public AppAlipayInfo() {
    }

    public AppAlipayInfo(String toUserId, String templateId, String headColor, String url, String actionName, List<AppDataInfo> data) {
        this.toUserId = toUserId;
        this.templateId = templateId;
        this.headColor = headColor;
        this.url = url;
        this.actionName = actionName;
        this.data = data;
    }

    public String getToUserId() {
        return toUserId;
    }

    public void setToUserId(String toUserId) {
        this.toUserId = toUserId;
    }

    public String getTemplateId() {
        return templateId;
    }

    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }

    public String getHeadColor() {
        return headColor;
    }

    public void setHeadColor(String headColor) {
        this.headColor = headColor;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getActionName() {
        return actionName;
    }

    public void setActionName(String actionName) {
        this.actionName = actionName;
    }

    public List<AppDataInfo> getData() {
        return data;
    }

    public void setData(List<AppDataInfo> data) {
        this.data = data;
    }

    public  AppAlipayInfo addData(AppDataInfo dataInfo){
        if(this.data==null){
            this.data=new ArrayList<>();
        }
        this.data.add(dataInfo);
        return this;
    }

    public static AppAlipayInfo.AppAliPayInfoBuilder builder(){
        return new AppAlipayInfo.AppAliPayInfoBuilder();
    }

    /**
     * 模板消息构造器
     */
    public static class AppAliPayInfoBuilder{
        private String toUserId;
        private String templateId;
        private String headColor;
        private String url;
        private String actionName;
        private List<AppDataInfo> data;

        AppAliPayInfoBuilder(){};

        public AppAliPayInfoBuilder toUserId(String toUserId) {
            this.toUserId = toUserId;
            return this;
        }

        public AppAliPayInfoBuilder templateId(String templateId) {
            this.templateId = templateId;
            return this;
        }

        public AppAliPayInfoBuilder headColor(String headColor) {
            this.headColor = headColor;
            return this;
        }

        public AppAliPayInfoBuilder url(String url) {
            this.url = url;
            return this;
        }

        public AppAliPayInfoBuilder actionName(String actionName) {
            this.actionName = actionName;
            return this;
        }

        public AppAliPayInfoBuilder data(List<AppDataInfo> data) {
            this.data = data;
            return this;
        }

        public AppAlipayInfo build(){
            return new AppAlipayInfo(this.toUserId,this.templateId,this.headColor,this.url,this.actionName,this.data);
        }

        @Override
        public String toString(){
            return "AppAlipayInfo.AppAliPayInfoBuilder(toUserId="+this.toUserId+",templateId="+this.templateId+",headColor="+this.headColor+",url="+this.url+",actionName="+this.actionName +",data="+this.data+")";
        }
    }
}
